package dynProxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.List;
import java.util.TreeSet;


public class Client {
	
	public static void main(String[] args) {
		
		Subject subject = new RealSubject();
		InvocationHandler hander = new MyInvocationHandler(subject);
		subject = (Subject)Proxy.newProxyInstance(subject.getClass().getClassLoader(), subject.getClass().getInterfaces(), hander);
		
		subject.doTask();
		List list = new ArrayList();
		list.add(null);
		
		
		TreeSet treeSet = new TreeSet();
		Subject subject2 = new RealSubject();
		Subject subject3 = new RealSubject();
		Subject subject4 = new RealSubject();
		treeSet.add(subject2);
		treeSet.add(subject3);
		treeSet.add(subject4);
		System.out.println(treeSet);
	}
}
